@extends('home.base.person')
@section('content')
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

<title>订单管理</title>

<link href="{{ asset('AmazeUI-2.4.2/assets/css/admin.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('AmazeUI-2.4.2/assets/css/amazeui.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('css/personal.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('css/orstyle.css') }}" rel="stylesheet" type="text/css">

<script src="{{ asset('AmazeUI-2.4.2/assets/js/jquery.min.js') }}"></script>
<script src="{{ asset('AmazeUI-2.4.2/assets/js/amazeui.js') }}"></script>
<div class="user-order">	
	<!--标题-->
	<div class="am-cf am-padding">
		<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">订单管理</strong> / <small>Order</small></div>
	</div>
	<hr/>
	<div class="am-tabs am-tabs-d2 am-margin" data-am-tabs>
		<ul class="am-avg-sm-5 am-tabs-nav am-nav am-nav-tabs">
			<li class="am-active"><a href="#tab1">所有订单</a></li>
			<li><a href="#tab2">待付款</a></li>
			<li><a href="#tab3">待发货</a></li>
			<li><a href="#tab4">待收货</a></li>
			<li><a href="#tab5">待评价</a></li>
		</ul>
		<div class="am-tabs-bd">
			<div class="am-tab-panel am-fade am-in am-active" id="tab1">
				<div class="order-top">
					<div class="th th-item">
						<td class="td-inner">商品</td>
					</div>
					<div class="th th-price">
						<td class="td-inner">单价</td>
					</div>
					<div class="th th-number">
						<td class="td-inner">数量</td>
					</div>
					<div class="th th-operation">
						<td class="td-inner">商品操作</td>
					</div>
					<div class="th th-amount">
						<td class="td-inner">合计</td>
					</div>
					<div class="th th-status">
						<td class="td-inner">交易状态</td>
					</div>
					<div class="th th-change">
						<td class="td-inner">交易操作</td>
					</div>
				</div>
				<div class="order-main">
					<div class="order-list">
						@foreach($list as $v)
						<!--交易成功-->
						<div class="order-status5">
							<div class="order-title">
								<div class="dd-num">订单编号：<a href="javascript:;">{{ $v->id }}</a></div>
								<span>成交时间：{{ date('Y-m-d H:i:s',$v->ptime) }}</span>
								<!--    <em>店铺：小桔灯</em>-->
							</div>
							<div class="order-content">
								<div class="order-left">
									<ul class="item-list">
										@foreach($v->g as $g1)
										<li class="td td-item">
											<div class="item-pic">
												<a href="#" class="J_MakePoint">
													<img src="{{ url('admin/upload/'.$g1->pic) }}" class="itempic J_ItemImg" width="78" height="78">
												</a>
											</div>
											<div class="item-info">
												<div class="item-basic-info">
													<a href="#">
														<p>{{ $g1->title }}</p>
														
													</a>
												</div>
											</div>
										</li>
										@endforeach
										<li class="td td-price">
											<div class="item-price">
												{{ $v->money }}
											</div>
										</li>
										<li class="td td-number">
											<div class="item-number">
												<span>×</span>1
											</div>
										</li>
										<li class="td td-operation">
											<div class="item-operation">
												
											</div>
										</li>
									</ul>
								</div>
								<div class="order-right">
									<li class="td td-amount">
										<div class="item-amount">
											合计：{{ $v->money }}
											<p>含运费：<span>10.00</span></p>
										</div>
									</li>
									<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">交易成功</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
												<p class="order-info"><a href="logistics.html">查看物流</a></p>
											</div>
										</li>
										@if($v->state == 5)
										<li class="td td-change">
											<a href="javascript:doDel( {{ $v->id }} )">
												<div class="am-btn am-btn-danger anniu">
													删除订单
												</div>
											</a>
										</li>
										@elseif($v->state == 1)
										<li class="td td-change">
											<a href="{{ url('home/success/'.$v->id) }}">
											<div class="am-btn am-btn-danger anniu">
												一键支付</div></a>
										</li>
										@elseif($v->state == 2)
										<li class="td td-change">
											<div class="am-btn am-btn-danger anniu">
												提醒发货</div>
										</li>
										@elseif($v->state == 3)
										<li class="td td-change">
											<a href=" javascript:doCheck( {{ $v->id }} )">
												<div class="am-btn am-btn-danger anniu">
													确认收货
												</div>
											</a>
										</li>
										@elseif($v->state ==4)
										<li class="td td-change">
											<a href="commentlist.html">
												<div class="am-btn am-btn-danger anniu">
													评价商品</div>
											</a>
										</li>
										@endif
									</div>
								</div>
							</div>
						</div>						
						@endforeach
						<form  method='post' name='myform2'>
							{{ csrf_field() }}
							{{ method_field('DELETE') }}
						</form>
						<script>
							function doDel(id){
								if(confirm('确定删除吗？')){
									var form2 = document.myform2;
									form2.action = '/home/order/'+id;
									form2.submit();
								}
							}
						</script>
					</div>
				</div>
			</div>
			<div class="am-tab-panel am-fade" id="tab2">
				<div class="order-top">
					<div class="th th-item">
						<td class="td-inner">商品</td>
					</div>
					<div class="th th-price">
						<td class="td-inner">单价</td>
					</div>
					<div class="th th-number">
						<td class="td-inner">数量</td>
					</div>
					<div class="th th-operation">
						<td class="td-inner">商品操作</td>
					</div>
					<div class="th th-amount">
						<td class="td-inner">合计</td>
					</div>
					<div class="th th-status">
						<td class="td-inner">交易状态</td>
					</div>
					<div class="th th-change">
						<td class="td-inner">交易操作</td>
					</div>
				</div>
				<div class="order-main">
					<div class="order-list">
						@foreach($list2 as $v1)
						<div class="order-status5">
							<div class="order-title">
								<div class="dd-num">订单编号：<a href="javascript:;">{{ $v1->id }}</a></div>
								<span>成交时间：{{ date('Y-m-d H:i:s',$v1->ptime) }}</span>
								<!--    <em>店铺：小桔灯</em>-->
							</div>
							<div class="order-content">
								<div class="order-left">
									<ul class="item-list">
										@foreach($v1->g as $g2)
										<li class="td td-item">
											<div class="item-pic">
												<a href="#" class="J_MakePoint">
													<img src="{{ url('admin/upload/'.$g2->pic) }}" class="itempic J_ItemImg" width="78" height="78">
												</a>
											</div>
											<div class="item-info">
												<div class="item-basic-info">
													<a href="#">
														<p>{{ $g2->title }}</p>
													</a>
												</div>
											</div>
										</li>
										@endforeach
										<li class="td td-price">
											<div class="item-price">
												{{ $v1->money }}
											</div>
										</li>
										<li class="td td-number">
											<div class="item-number">
												<span>×</span>1
											</div>
										</li>
										<li class="td td-operation">
											<div class="item-operation">												
											</div>
										</li>
									</ul>
								</div>
								<div class="order-right">
									<li class="td td-amount">
										<div class="item-amount">
											合计：{{ $v1->money }}
											<p>含运费：<span>10.00</span></p>
										</div>
									</li>
									<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">交易成功</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
												<p class="order-info"><a href="logistics.html">查看物流</a></p>
											</div>
										</li>
										<li class="td td-change">
											<a href="{{ url('home/order/dopay/'.$v1->id) }}">
											<div class="am-btn am-btn-danger anniu">
												一键支付</div></a>
										</li>
									</div>
								</div>
							</div>
						</div>
						@endforeach
					</div>
				</div>
			</div>
			<div class="am-tab-panel am-fade" id="tab3">
				<div class="order-top">
					<div class="th th-item">
						<td class="td-inner">商品</td>
					</div>
					<div class="th th-price">
						<td class="td-inner">单价</td>
					</div>
					<div class="th th-number">
						<td class="td-inner">数量</td>
					</div>
					<div class="th th-operation">
						<td class="td-inner">商品操作</td>
					</div>
					<div class="th th-amount">
						<td class="td-inner">合计</td>
					</div>
					<div class="th th-status">
						<td class="td-inner">交易状态</td>
					</div>
					<div class="th th-change">
						<td class="td-inner">交易操作</td>
					</div>
				</div>
				<div class="order-main">
					<div class="order-list">
						@foreach($list3 as $v3)
						<div class="order-status2">
							<div class="order-title">
								<div class="dd-num">订单编号：<a href="javascript:;">{{ $v3->id }}</a></div>
								<span>成交时间：{{ date('Y-m-d H:i:s',$v3->ptime) }}</span>
								<!--    <em>店铺：小桔灯</em>-->
							</div>
							<div class="order-content">
								<div class="order-left">
									<ul class="item-list">
										@foreach($v3->g as $g4)
										<li class="td td-item">
											<div class="item-pic">
												<a href="#" class="J_MakePoint">
													<img src="{{ url('admin/upload/'.$g4->pic) }}" class="itempic J_ItemImg" width="78" height="78">
												</a>
											</div>
											<div class="item-info">
												<div class="item-basic-info">
													<a href="#">
														<p>{{ $g4->title }}</p>
													</a>
												</div>
											</div>
										</li>
										@endforeach
										<li class="td td-price">
											<div class="item-price">
												{{ $v3->money }}
											</div>
										</li>
										<li class="td td-number">
											<div class="item-number">
												<span>×</span>2
											</div>
										</li>
										<li class="td td-operation">
											<div class="item-operation">
												<a href="refund.html">退款</a>
											</div>
										</li>
									</ul>
								</div>
								<div class="order-right">
									<li class="td td-amount">
										<div class="item-amount">
											合计：{{ $v3->money }}
											<p>含运费：<span>10.00</span></p>
										</div>
									</li>
									<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">买家已付款</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
											</div>
										</li>
										<li class="td td-change">
											<div class="am-btn am-btn-danger anniu">
												提醒发货</div>
										</li>
									</div>
								</div>
							</div>
						</div>
						@endforeach
					</div>
				</div>
			</div>
			<div class="am-tab-panel am-fade" id="tab4">
				<div class="order-top">
					<div class="th th-item">
						<td class="td-inner">商品</td>
					</div>
					<div class="th th-price">
						<td class="td-inner">单价</td>
					</div>
					<div class="th th-number">
						<td class="td-inner">数量</td>
					</div>
					<div class="th th-operation">
						<td class="td-inner">商品操作</td>
					</div>
					<div class="th th-amount">
						<td class="td-inner">合计</td>
					</div>
					<div class="th th-status">
						<td class="td-inner">交易状态</td>
					</div>
					<div class="th th-change">
						<td class="td-inner">交易操作</td>
					</div>
				</div>
				<div class="order-main">
					<div class="order-list">
						@foreach($list4 as $v4)
						<div class="order-status3">
							<div class="order-title">
								<div class="dd-num">订单编号：<a href="javascript:;">{{ $v4->id }}</a></div>
								<span>成交时间：{{ date('Y-m-d H:i:s',$v4->ptime) }}</span>
								<!--    <em>店铺：小桔灯</em>-->
							</div>
							<div class="order-content">
								<div class="order-left">

									<ul class="item-list">
										@foreach($v4->g as $g5)
										<li class="td td-item">
											<div class="item-pic">
												<a href="#" class="J_MakePoint">
													<img src="{{ url('admin/upload/'.$g5->pic) }}" class="itempic J_ItemImg" width="78" height="78">
												</a>
											</div>
											<div class="item-info">
												<div class="item-basic-info">
													<a href="#">
														<p>{{ $g5->title }} </p>
													</a>
												</div>
											</div>
										</li>
										@endforeach
										<li class="td td-price">
											<div class="item-price">
												{{ $v->money }}
											</div>
										</li>
										<li class="td td-number">
											<div class="item-number">
												<span>×</span>2
											</div>
										</li>
										<li class="td td-operation">
											<div class="item-operation">
												<a href="refund.html">退款/退货</a>
											</div>
										</li>
									</ul>
								</div>
								<div class="order-right">
									<li class="td td-amount">
										<div class="item-amount">
											合计：676.00
											<p>含运费：<span>10.00</span></p>
										</div>
									</li>
									<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">卖家已发货</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
												<p class="order-info"><a href="logistics.html">查看物流</a></p>
												<p class="order-info"><a href="#">延长收货</a></p>
											</div>
										</li>
										<li class="td td-change">
											<a href=" javascript:doCheck( {{ $v4->id }} )">
											<div class="am-btn am-btn-danger anniu">
												确认收货
											</div>
											</a>
										</li>
									</div>
								</div>
							</div>
						</div>					
						@endforeach
						<form  method='post' name='myform1'>
							{{ csrf_field() }}
							{{ method_field('PUT') }}
						</form>
						<script>
							function doCheck(id){
								if(confirm('确认收货吗？')){
									var form1 = document.myform1;
									form1.action = '/home/order/'+id;
									form1.submit();
								}
							}
						</script>
					</div>
				</div>
			</div>
			<div class="am-tab-panel am-fade" id="tab5">
				<div class="order-top">
					<div class="th th-item">
						<td class="td-inner">商品</td>
					</div>
					<div class="th th-price">
						<td class="td-inner">单价</td>
					</div>
					<div class="th th-number">
						<td class="td-inner">数量</td>
					</div>
					<div class="th th-operation">
						<td class="td-inner">商品操作</td>
					</div>
					<div class="th th-amount">
						<td class="td-inner">合计</td>
					</div>
					<div class="th th-status">
						<td class="td-inner">交易状态</td>
					</div>
					<div class="th th-change">
						<td class="td-inner">交易操作</td>
					</div>
				</div>
				<div class="order-main">
					<div class="order-list">
					@foreach($list5 as $v5)
						<div class="order-status3">
							<div class="order-title">
								<div class="dd-num">订单编号：<a href="javascript:;">{{ $v5->id }}</a></div>
								<span>成交时间：{{ date('Y-m-d H:i:s',$v5->ptime) }}</span>
								<!--    <em>店铺：小桔灯</em>-->
							</div>
							<div class="order-content">
								<div class="order-left">
									<ul class="item-list">
										@foreach($v5->g as $g6)
										<li class="td td-item">
											<div class="item-pic">
												<a href="#" class="J_MakePoint">
													<img src="{{ url('admin/upload/'.$g6->pic) }}" class="itempic J_ItemImg" width="78" height="78">
												</a>
											</div>
											<div class="item-info">
												<div class="item-basic-info">
													<a href="#">
														<p>{{ $g6->title }} </p>
													</a>
												</div>
											</div>
										</li>
										@endforeach
										<li class="td td-price">
											<div class="item-price">
												333.00
											</div>
										</li>
										<li class="td td-number">
											<div class="item-number">
												<span>×</span>2
											</div>
										</li>
										<li class="td td-operation">
											<div class="item-operation">
												<a href="refund.html">退款/退货</a>
											</div>
										</li>
									</ul>
								</div>
								<div class="order-right">
									<li class="td td-amount">
										<div class="item-amount">
											合计：676.00
											<p>含运费：<span>10.00</span></p>
										</div>
									</li>
									<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">卖家已发货</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
												<p class="order-info"><a href="logistics.html">查看物流</a></p>
												<p class="order-info"><a href="#">延长收货</a></p>
											</div>
										</li>
										<li class="td td-change">
											<a href="commentlist.html">
												<a href="{{ url('home/comment') }}">
													<div class="am-btn am-btn-danger anniu">
														评价商品
													</div>
												</a>
											</a>
										</li>	
									</div>
								</div>
							</div>
						</div>
						@endforeach
					</div>
				</div>
			</div>
		</div>
	</div>
</div>				
@endsection